/*
 * @Author: 
 * @Date: 2025-09-16 16:01:08
 * @LastEditor: zhuxiaoyi
 * @LastEditTime: 2025-09-16 16:51:57
 * @Description: 
 */
import { NestFactory } from '@nestjs/core';
import { ValidationPipe } from '@nestjs/common';
import { DocumentBuilder, SwaggerModule } from '@nestjs/swagger';
import { AppModule } from './app.module';

async function bootstrap() {
  const app = await NestFactory.create(AppModule);

  // 全局验证管道
  app.useGlobalPipes(
    new ValidationPipe({
      whitelist: true,
      forbidNonWhitelisted: true,
      transform: true,
    }),
  );

  // Swagger 配置
  const config = new DocumentBuilder()
    .setTitle('减灾中心外协人员管理平台 API')
    .setDescription('减灾中心外协人员管理平台的用户管理系统接口文档')
    .setVersion('1.0')
    .addTag('用户管理')
    .build();

  const document = SwaggerModule.createDocument(app, config);
  SwaggerModule.setup('api', app, document);

  await app.listen(6001);
  console.log('应用运行在: http://localhost:6001');
  console.log('Swagger 文档: http://localhost:6001/api');
}
bootstrap();